<!--#include file="classData.asp"-->
<%
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.AddHeader "Pragma", "No-Cache"

	tstate = 0

	lps1 = Request.Cookies("LeaguePlanState")
	lps2 = Request.Cookies("LeaguePlanState2")
	
	
	If lps1 <> "" Then

	  Response.Cookies("LeaguePlanState") = ""
	  Response.Cookies("LeaguePlanState1") = ""
	  
	  tstate = 1
	
	End If
	
	
	If tstate = 1 Then
	
	lpid = CInt(Request.QueryString("lpid"))
	maid = CInt(Request.QueryString("maid"))
	R1F = CInt(Request.QueryString("R1F"))
	R1S = CInt(Request.QueryString("R1S"))

	set HuaObj = new sysData
	HuaObj.sqlConnOpen()

	set SystemRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery SystemRds,"sysVar",QueryStr,0," VarId = 1"
	
	CurrentSeason = SystemRds("CurrentSeason")

	SystemRds.Close




	HuaObj.p_DbConnection.BeginTrans
	on error resume next


	InsertSql = "UPDATE LeaguePlan SET HomeScore = "&R1F&",AwayScore = "&R1S&",IfDone = 1,SubmitUserId = "&maid&",SubmitDate = '"&Date&"' WHERE LPId = "&lpid
	HuaObj.SCommand(InsertSql)
	
	InsertSql = "UPDATE LeaguePlan SET ConfirmUserId = HomeId WHERE LPId = "&lpid&" AND SubmitUserId = AwayId "
	HuaObj.SCommand(InsertSql)

	InsertSql = "UPDATE LeaguePlan SET ConfirmUserId = AwayId WHERE LPId = "&lpid&" AND SubmitUserId = HomeId "
	HuaObj.SCommand(InsertSql)
	
	InsertSql = "INSERT INTO LeagueLog VALUES("&lpid&",'"&lps1&"',"&lps2&",'"&date&" "&time&"',"&maid&",'ls')"
	HuaObj.SCommand(InsertSql)

	response.ContentType="text/xml"	
	Response.Write("<?xml version=""1.0"" encoding=""gb2312""?>"&vbcrlf)
	Response.Write("<xml>"&vbcrlf)


	if err.number =0 then  
    	HuaObj.p_DbConnection.CommitTrans  '如果没有conn错误，则执行事务提交
		Response.Write("<Shi ShiId = ""1"">"&vbcrlf)
		Response.Write("</Shi>"&vbcrlf)
	else 
    	HuaObj.p_DbConnection.RollbackTrans '否则回滚
		Response.Write("<Shi ShiId = ""0"">"&vbcrlf)
		Response.Write("</Shi>"&vbcrlf)
	end if

	Response.Write("</xml>"&vbcrlf)

	
	HuaObj.sqlConnClose()

	End If
%>
